from base.Base import Base
from selenium.webdriver.common.by import By
import time
class Page_add(Base):
    #点击进入电影评论接口
    button_loc={By.XPATH,'/html/body/div[1]/div/section/aside/ul/li/ul/li[2]/a'}
    def button(self):
        self.click(self.button_loc)
    #点击发布按钮
    fabu_loc={By.XPATH,'/html/body/div[1]/div/section/section/main/form/div/div[2]/div/div/button[2]'}
    def fabu(self):
        self.click(self.fabu_loc)
    #点击输入序号
    id_loc={By.XPATH,'/html/body/div[1]/div/section/section/main/div/div/div[1]/div/input'}
    def id(self):
        self.send_keys(self.id_loc,'5')

    # 点击输入标题
    title_loc = {By.XPATH, '/html/body/div[1]/div/section/section/main/form/div[1]/div/div[1]/div/input'}
    def title(self):
        self.send_keys(self.title_loc, '电热毯')
    #点击输入价格
    price_loc={By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[2]/div/div[1]/div/input'}
    def price(self):
        self.send_keys(self.price_loc,'30')
    #点击输入状态
    status_loc={By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[3]/div/div[1]/div/input'}
    def status(self):
        self.send_keys(self.status_loc,'1')
    #点击输入用户
    user_loc={By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[4]/div/div[1]/div/input'}
    def user(self):
        self.send_keys(self.user_loc,'1')
    #点击提交
    commit_loc={By.XPATH,'/html/body/div[1]/div/section/section/main/form/div[5]/div/button[1]'}
    def commit(self):
        self.click(self.commit_loc)

    def add_right(self):
        self.openurl("http://localhost:8080/")
        time.sleep(2)
        self.button()
        time.sleep(2)
        self.fabu()
        time.sleep(2)
        self.id()
        time.sleep(2)
        self.title()
        time.sleep(2)
        self.price()
        time.sleep(2)
        self.status()
        time.sleep(2)
        self.user()
        time.sleep(2)
        self.commit()
        time.sleep(2)
